package com.hjl.config;

import com.hjl.interceptor.LoginProtectedInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ServivE
 * @version 0.1
 * @className WebMvcConfig
 * @description
 * @date 2024/8/23 20:19
 * @since jdk17
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    //将登录保护拦截器注入进来
    @Autowired
    private LoginProtectedInterceptor loginProtectedInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginProtectedInterceptor).addPathPatterns("/headline/**");
    }
}
